<template>
	<view>
		<nav-bar   fontColor="#FFFFFF" title="查询"></nav-bar>
		<!-- 公共组件-每个页面必须引入 -->
		<public-module></public-module>

		<view class="input_form_box">
			<view class="input_box btm_line">
				<view class="name">出库单号:</view>
				<view class="select_info1">
					<view class="input_info">
						<uni-easyinput :styles="styles" :placeholderStyle="placeholderStyle" v-model="idNo" focus
							placeholder="请输入出库单号:"></uni-easyinput>
					</view>
				</view>
			</view>
		<!-- 	<view class="input_box btm_line">
				<view class="name">物品编号:</view>
				<view class="select_info1">
					<view class="input_info">
						<uni-easyinput :styles="styles" :placeholderStyle="placeholderStyle" v-model="serialNo" focus
							placeholder="请输入物品编号:"></uni-easyinput>
					</view>
				</view>
			</view>
			<view class="input_box btm_line">
				<view class="name">射频标签:</view>
				<view class="select_info">
					<view class="input_info">
						<uni-easyinput :styles="styles" :placeholderStyle="placeholderStyle" v-model="rfid" focus
							placeholder="请扫描射频标签:"></uni-easyinput>

					</view>
				</view>
			</view> -->
		</view>
		<view style="margin-top: 10rpx;" v-for="(item,index) in dataList">
			<uni-list>
				<uni-list-item :index="index+1" @click="goCheckList(item.rfidCode)"
					:title="'物品名称:'+item.itemName + '\n物品编号:'+item.serialNo"
					:note="'案件名称:'+item.caseName + '\n'+ '案件编号:'+item.caseNo + '\n' + '库位编号:' + item.storeLotNo" link="reLaunch" clickable>
				</uni-list-item>
			</uni-list>
		</view>
		<view style="height: 150rpx;">
			<view style="position: fixed;bottom: 20rpx;width: 100%;z-index: 999;">
				<button @click="submit()"
					style="background: #3B5DE0;color: #FFFFFF;border-radius: 10rpx;width: 90%;height: 100rpx;margin: 0 auto;letter-spacing: 5rpx;">查询</button>
			</view>
		</view>
		<uni-popup ref="message" type="message">
			<uni-popup-message :type="msgType" :message="messageText" :duration="3000"></uni-popup-message>
		</uni-popup>
	</view>
</template>

<script>
	var main = null;
	var receiver = null;
	// import uniIcons from '@/components/uni-icons/uni-icons.vue';
	import ldSelect from '@/components/ld-select/ld-select.vue'
	export default {
		components: {
			// uniIcons,
			ldSelect
		},
		data() {
			return {
				placeholderStyle: "font-size:30rpx;color:#666666;letter-spacing: 3rpx;",
				styles: {
					color: '#000000',
					borderColor: 'transparent',
					backgroundColor: '#f5f5f5',
				},
				idNo: '',
				rfid: '',
				serialNo: '',
				dataList: [],
				msgType: 'success',
				messageText: '这是一条成功提示',
			};
		},
		onLoad() {
			this.get_gb();
		},
		onBackPress() {
			if (receiver != null) {
				main.unregisterReceiver(receiver)
			}
		},
		//方法
		methods: {
			get_gb() {
				var that = this;
				main = plus.android.runtimeMainActivity();
				receiver = plus.android.implements('io.dcloud.android.content.BroadcastReceiver', {
					onReceive: function(context, intent) {
						plus.android.importClass(intent);
						var data = intent.getExtra("data");
						if (data) {
							that.rfid = data
							console.log(that.rfid)
						}
					}
				});
				var IntentFilter = plus.android.importClass('android.content.IntentFilter');
				let filter = new IntentFilter();
				filter.addAction('android.rfid.epccode');
				var info = main.registerReceiver(receiver, filter)
				// main.unregisterReceiver(receiver)
			},
			messageToggle(type,msg) {
				this.msgType = type
				this.messageText = msg
				this.$refs.message.open();
			},
			submit() {
				
			},
			goCheckList(e) {
				if (e) {
					uni.navigateTo({
						url: '/pages/event/checkList?id=' + e
					})
				} else {
					uni.showToast({
						title: '无芯片数据',
						icon: 'error'
					});
				}

			}
		}
	}
</script>
<style lang="scss" scoped>
	@import '@/style/mixin.scss';

	.textArea {
		border: 1px dashed #d9d9d9;
		// color: #d9d9d9;
		border-radius: 15rpx;
		padding: 20rpx;
		margin-left: 20rpx;
		height: 100rpx;
		width: 85%;
		font-size: 30rpx;
	}

	.select {
		margin-left: 100rpx;
	}

	.scan_ico_class {
		position: absolute;
		right: 30upx;
	}

	.table_box {
		background-color: rgba($color: $themeColor, $alpha: 1);

		.table_title {
			padding: 0rpx 20rpx;
			font-size: 22rpx;
			height: 60rpx;
			line-height: 60rpx;
			color: #ffffff;
			text-align: center;
			font-weight: bold;
			background-color: rgba($color: $themeColor, $alpha: 1);
		}

		.table_head {
			display: flex;
			align-content: center;
			background-color: rgba($color: $themeColor, $alpha: 0.35);

			text {
				padding: 15rpx 20rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				flex: 1;
				flex-shrink: 0;
				font-size: 28rpx;
				color: #333;
				font-weight: bold;
				border-right: 2rpx solid rgba($color: $themeColor, $alpha: 0.2);

				&:last-child {
					border-right: 0;
					flex: 2;
				}
			}
		}

		.table_content {
			display: flex;
			align-content: center;
			border-top: 2rpx solid rgba($color: $themeColor, $alpha: 0.2);
			background-color: #f5ffc6;

			text {
				padding: 15rpx 20rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				flex: 1;
				font-size: 22rpx;
				color: #999;
				border-right: 2rpx solid rgba($color: $themeColor, $alpha: 0.3);

				&:last-child {
					border-right: 0;
					flex: 2;
				}
			}
		}
	}
</style>
